package com.ndbg.juc.executor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author chenXB
 * @createTime 2024年10月18日 17:31:00
 */
public class DemoTest {
    public static void main(String[] args) {
        ExecutorService executor = Executors.newFixedThreadPool(10);

//        Executors.newCachedThreadPool();
//        ExecutorService executor = Executors.newFixedThreadPool(10);
//        Callable<String> callableTask = () -> {
//            TimeUnit.MILLISECONDS.sleep(300);
//            return "Task's execution";
//        };
//        Runnable runnableTask = () -> {
//            try {
//                TimeUnit.MILLISECONDS.sleep(300);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        };
//        Future<String> submit = executor.submit(callableTask);

//        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();

//        Executor executor = MoreExecutors.directExecutor();
//        AtomicBoolean executed = new AtomicBoolean();
//        executor.execute(() -> {
//            try {
//                Thread.sleep(500);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//            executed.set(true);
//        });

    }

}
